<template>
<div>
     <van-nav-bar
      title="不凡"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="list" v-for="item in address1" :key="item.address1">
        <div class="name">{{item.name}}</div>
        <div class="dizhi">{{item.address}}</div>
        <div class="mobile">{{item.mobile}}</div>
        <div class="mr" v-if="item.is_default">默认地址</div>
        <div class="edit" @click="edit1(item.id)"><img src="../../../img/edit.png"></div>
    </div>
    <router-link to="/my/address/1"><div class="new">+新建地址</div></router-link>
</div>
</template>

<script>
import {getListAction} from '@/api/address/index.js'
export default {
    data(){
        return{
           address1:[]
        }
    },
    created(){
        getListAction({
            openId:'oQmbb4sNZdxaUQZ0sfYgvtOP2S7c'
        })
        .then(res=>{
            console.log(res)
            this.address1=res.data
            console.log(res.data)
        })
    },
    methods:{
       onClickLeft() {
            this.$router.go(-1)
        },
        edit1(id){
            this.$router.push({path:'/my/address/2',query:{id}})
        }

    }

}
</script>

<style>
.list{
    position: relative;
    width: 355px;
    height: 97px;
    border-bottom: 2px solid #f1f1f1;
    margin: 0 auto;
}
.name{
    position: absolute;
    left: 0;
    top: 0;
    width: 80px;
    height: 57px;
    line-height:50px;
}
.dizhi{
    position: absolute;
    left: 80px;
    top: 0;
    width: 200px;
    height: 40px;
    line-height: 37px;
}
.mobile{
    position: absolute;
    left: 80px;
    top: 40px;
    width: 200px;
    height: 39px;
}
.edit{
    position: absolute;
    top: 30px;
    left: 320px;
    width: 20px;
    height: 20px;
}
.edit img{
    width: 100%;
    height: 100%;
}
.new{
    position: fixed;
    bottom: 10px;
    left: 10px;
    width: 355px;
    height: 30px;
    color: #B4282D;
    border: 1px solid #B4282D;
    line-height: 30px;
}
.mr{
    position: absolute;
    top: 50px;
    left: 20px;
    width: 50px;
    height: 20px;
    color: #B4282D;
    border: 1px solid #B4282D;
}
</style>